namespace KPIS.GERP.Models.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class update0072 : DbMigration
    {
        public override void Up()
        {
            AddColumn("dbo.SysTask", "ApplyToEmpId", c => c.Int(nullable: false, defaultValue:1));
            AddColumn("dbo.SysTask", "AppPrcId", c => c.Int(nullable: false));
            AddColumn("dbo.SysTask", "RefId", c => c.Int(nullable: false));
            AddColumn("dbo.SysTask", "Amount", c => c.Decimal(nullable: false, precision: 18, scale: 2));
            AddColumn("dbo.SysTask", "RefCode", c => c.String());
            AddColumn("dbo.SysTask", "CreateResult", c => c.String());
            AddColumn("dbo.SysTask", "CreateErrorResult", c => c.String());
            AddColumn("dbo.SysTask", "Remark", c => c.String());
            AddColumn("dbo.SysTask", "SystemRemark", c => c.String());
            AddColumn("dbo.SysTask", "ConfirmAs", c => c.String());
            AddColumn("dbo.SysTask", "ApproveAs", c => c.String());
            AddColumn("dbo.SysTaskHistory", "SystemRemark", c => c.String());
            AddForeignKey("dbo.SysTask", "ApplyToEmpId", "dbo.hrm_ps_employees", "emp_seq", cascadeDelete: true);
            AddForeignKey("dbo.SysTask", "CreatedBy", "dbo.hrm_ps_employees", "emp_seq");
            CreateIndex("dbo.SysTask", "ApplyToEmpId");
            CreateIndex("dbo.SysTask", "CreatedBy");
            DropColumn("dbo.SysTaskHistory", "NextStepNo");
        }
        
        public override void Down()
        {
            AddColumn("dbo.SysTaskHistory", "NextStepNo", c => c.Int());
            DropIndex("dbo.SysTask", new[] { "CreatedBy" });
            DropIndex("dbo.SysTask", new[] { "ApplyToEmpId" });
            DropForeignKey("dbo.SysTask", "CreatedBy", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.SysTask", "ApplyToEmpId", "dbo.hrm_ps_employees");
            DropColumn("dbo.SysTaskHistory", "SystemRemark");
            DropColumn("dbo.SysTask", "ApproveAs");
            DropColumn("dbo.SysTask", "ConfirmAs");
            DropColumn("dbo.SysTask", "SystemRemark");
            DropColumn("dbo.SysTask", "Remark");
            DropColumn("dbo.SysTask", "CreateErrorResult");
            DropColumn("dbo.SysTask", "CreateResult");
            DropColumn("dbo.SysTask", "RefCode");
            DropColumn("dbo.SysTask", "Amount");
            DropColumn("dbo.SysTask", "RefId");
            DropColumn("dbo.SysTask", "AppPrcId");
            DropColumn("dbo.SysTask", "ApplyToEmpId");
        }
    }
}
